package com.pengshun.modules.api.transport.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.pengshun.modules.api.coal.util.CommonUtil;
import com.pengshun.modules.api.coal.validator.Fourth;
import com.pengshun.modules.domain.TransportAssign;
import com.pengshun.modules.domain.VehicleType;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
public class TransportOrderDto {

    private Long orderId;
    private String coalName;
    private String orderNo;
    private String name;
    private String phone;
    private String coalPic;
    @NotNull(message = "id不能为空", groups = {Fourth.class})
    private Long orderAllotTransportId;
    private BigDecimal freight;
    private BigDecimal totalFreight;
    private BigDecimal sellPrice;
    private BigDecimal allotNumber;
    @NotNull(message = "状态不能为空", groups = {Fourth.class})
    private Integer status;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
    private Date allotTime;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
    private Date backTime;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
    private Date sureTime;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
    private Date issueTime;

    private String merchantName;
    private String abbreviationAddress;
    private Long merchantId;
    private Double lngX;
    private Double latY;
    private Double startlngX;
    private Double startlatY;
    private String province;
    private Integer sdId;
    private Integer adcode;
    private Integer isApply;
    private String city;
    private String district;
    private String startProvince;
    private String startCity;
    private String startDistrict;
    private String userName;
    private Double distance;
    private String remark;

    private String startAddress;
    private String endAddress;
    private String linkmanPhone;
    private String merchantAddress;

    private String mineMouthName;
    private String merchantProvince;
    private String merchantCity;
    private String merchantDistrict;
    private Double merchantlngX;
    private Double merchantlatY;




    private List<TransportAssign> transportAssigns;
    private List<VehicleType> vehicleTypes;

    private Long userId;

    public String getDistrict() {
        distance = CommonUtil.GetDistance(latY, lngX, startlatY, startlngX);
        return district;
    }
}
